﻿/*  CamHelper (See http://camhelper.codeplex.com/ or https://bitbucket.org/AndiKS/camhelper for more Info)
    Copyright (C) 2011 Andreas Wimmer

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using CamHelper.Engine;
using CamHelper.Facade;
using SystemWrapper.IO;

namespace CamHelper.Worker
{
    public class InsertDataWorker : BaseWorker
    {
        private ITopSolidDocument _document;
        private IFileWrap _file;
        private IEnvironmentWrap _environment;

        public InsertDataWorker(ITopSolidDocument document, IFileWrap file, IEnvironmentWrap environment)
        {
            _document = document;
            _file = file;
            _environment = environment;
        }

        public override void Work()
        {
            throw new NotImplementedException();
        }

        public void ReadFile(string path)
        {

        }

        public void Action(string sourceType, string sourceName, string targetType, string targetName)
        {
            string source = String.Empty;

            if (sourceType == "Environment" && sourceName == "UserName")
            {
                source = _environment.UserName;
            }

            if (targetType == "Field")
            {
                if (targetName == "Author")
                {
                    _document.ComDocument.Author = source;
                }
            }
        }
    }
}
/*
<?xml version="1.0" encoding="UTF-8" ?>
<InsertData>
    <Action SourceType="Environment" SourceName="UserName" TargetType="Field" TargetName="Author" />
    
</InsertData>
*/